package sword;

/**
 * @Author: 海琳琦
 * @Date: 2022/5/28 22:11
 * https://leetcode.cn/problems/fan-zhuan-dan-ci-shun-xu-lcof/
 */
public class Title58I {

    public String reverseWords(String s) {
        String[] split = s.trim().split(" +");
        StringBuilder result = new StringBuilder();
        for (int i = split.length - 1; i >= 0; i--) {
            result.append(split[i]);
            if (i != 0) {
                result.append(" ");
            }
        }
        return result.toString();
    }

    public static void main(String[] args) {

    }
}
